//
//  BaseTableViewController.swift
//  0729FirstProgramMicroblog
//
//  Created by ding on 15/7/29.
//  Copyright © 2015年 ding. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController, VistorViewDelegate {
    /// 用户登陆标记
    var userLoginFlag = UserAcountInfo.userAccountInfo
    /// 访客视图
    var viewForVistor: VistorView?
    
    override func loadView() {
//        super.loadView()
        (userLoginFlag != nil) ? super.loadView() : showVistorView()
    }
    
    private func showVistorView() {
        viewForVistor = VistorView()
        viewForVistor?.delegate = self
        view = viewForVistor
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "VistorViewLogin")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "VistorViewRegister")
    }
    
    func VistorViewLogin() {
        let nav = UINavigationController(rootViewController: OAuthViewController())
        nav.title = "授权登陆"
        presentViewController(nav, animated: true) { () -> Void in
            print("denglu.....")
        }
        
    }
    
    func VistorViewRegister() {
        print("zhuce.....")
    }

}
